package org.jeecg.modules.fk.service.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.common.util.MyStringUtil;
import org.jeecg.modules.fk.entity.FactorPool;
import org.jeecg.modules.fk.mapper.FactorPoolMapper;
import org.jeecg.modules.fk.service.IFactorPoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @Description: factor_pool
 * @Author: ZJJ
 * @Date: 2021-04-30
 * @Version: V1.0
 */
@Service
//@DS("fk_oracle")
public class FactorPoolServiceImpl extends ServiceImpl<FactorPoolMapper, FactorPool> implements IFactorPoolService {
    @Autowired
    private FactorPoolMapper factorPoolMapper;

    @Override
    public List<String> getFactorSourceList(Integer type) {
        return factorPoolMapper.getFactorSourceList(type);
    }

    @Override
    public List<String> getFactorNameList() {
        return factorPoolMapper.getFactorNameList();
    }

    @Override
    public List<FactorPool> queryPageList(FactorPool factorPool) {
        String keyWord = factorPool.getKeyWord();
        if (StringUtils.hasLength(keyWord)) {
            List<Integer> types = MyStringUtil.str2IntegerList(keyWord);
            if (types != null && types.size() > 0) {
                if (!types.contains(0)) {
                    factorPool.setTypeList(types);
                }
            }
        }
        return factorPoolMapper.queryPageList(factorPool);
    }
}
